//
//  YSCenterViewController.m
//  YSKitDemo
//
//  Created by MOLBASE on 2018/8/14.
//  Copyright © 2018年 YangShen. All rights reserved.
//

#import "YSCenterViewController.h"
#import "YSSlideMenu.h"

@interface YSCenterViewController ()

@end

@implementation YSCenterViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = [UIColor whiteColor];
    self.title = @"消息";

    //左
    UIButton *headerButton = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 37, 37)];
    headerButton.layer.cornerRadius = headerButton.bounds.size.width/2.0f;
    headerButton.layer.masksToBounds = true;
    [headerButton setImage:[UIImage imageNamed:@"header"] forState:UIControlStateNormal];
    [headerButton addTarget:self action:@selector(showLeft) forControlEvents:UIControlEventTouchUpInside];
    self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:headerButton];

    //右
    UIButton *moreButton = [[UIButton alloc] initWithFrame:CGRectMake(0, 0, 25, 25)];
    [moreButton setImage:[UIImage imageNamed:@"more"] forState:UIControlStateNormal];
    [moreButton addTarget:self action:@selector(showRight) forControlEvents:UIControlEventTouchUpInside];
    self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:moreButton];

    UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, self.view.bounds.size.width, self.view.bounds.size.height - 64)];
    imageView.image = [UIImage imageNamed:@"QQChatList"];
    [self.view addSubview:imageView];

    UIButton *backButton = [UIButton buttonWithType:UIButtonTypeCustom];
    backButton.backgroundColor = [UIColor blueColor];
    backButton.frame = CGRectMake(0, 0, 100, 50);
    backButton.center = self.view.center;
    [backButton setTitle:@"Back" forState:UIControlStateNormal];
    [backButton addTarget: self action:@selector(backEvent) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:backButton];
}

- (void)backEvent {
    [self dismissViewControllerAnimated:YES completion:nil];
}

- (void)showLeft {
    [self.ys_sldeMenu showLeftViewControllerAnimated:YES];
}

- (void)showRight {
    [self.ys_sldeMenu showRightViewControllerAnimated:YES];
}


@end
